package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.PackBean;
import com.xuxin.nantai.contract.PackContract;
import com.xuxin.nantai.model.PackModel;

/**
 * Created by xu_xin
 * Created on 2020.06.19 0019
 */
public class PackPresenter implements PackContract.Presenter {
    private PackModel model;
    private PackContract.View view;

    public PackPresenter(PackContract.View view) {
        model = new PackModel();
        this.view = view;
    }

    @Override
    public void getPack(String LoginName, String ProductInfo, String InspectorInfo, int PageIndex) {
        if (null != model) {
            model.getPack(this, LoginName, ProductInfo, InspectorInfo, PageIndex);
        }
    }

    @Override
    public void deletePack(String UserName, String Guid) {
        if (null != model) {
            model.deletePack(this, UserName, Guid);
        }
    }

    @Override
    public void onSuccess(PackBean packBean) {
        if (null != view) {
            view.onSuccess(packBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}